ABC054 C - One-stroke Path
提出
code: python
from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
for i in ab:
print(graph)
ans = 0
while que:
next = que.popleft()
for i in next:
print(visited)
解答
code: python
import itertools
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(list)
for a, b in ab:
# print(d)
ans = 0
# 頂点を並び替える順列を生成してループ
for top in itertools.permutations(range(1, n+1), n):
# print(top)
# (1, 2, 3)
# (1, 3, 2)
# (2, 1, 3)
# (2, 3, 1)
# (3, 1, 2)
# (3, 2, 1)
# 頂点1が始点
# 生成した順列の中をさらにループ
for t in range(n):
# 全てにおいて条件を満たすパスが存在する
if t == n - 1:
ans += 1
break
# topt から topt + 1 に行くパスがなければ終了 if topt+1 not in d[topt]: break
else:
break
print(ans)
テーマ
メモ
提出
AC/WA
code: python
from collections import deque
from collections import defaultdict
n, m = map(int,input().split())
d = defaultdict(list)
for a, b in ab:
que = deque()
que.append(1)
while que:
now = que.popleft()
continue
else:
que.append(i)
print(dis.count(max(dis)))